package com.talkingdata.hadoop.guard.schedule;

import com.talkingdata.hadoop.guard.mapper.RmMapper;
import com.talkingdata.hadoop.guard.mapper.SchedulerReportMapper;
import com.talkingdata.hadoop.guard.service.DailyReport;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class Report {

    public static Logger log = Logger.getLogger(Report.class);
    @Autowired
    SchedulerReportMapper schedulerReportMapper;

    @Autowired
    DailyReport dailyReport;

    @Autowired
    RmMapper rmMapper ;

    //@Scheduled(fixedRate = 2 * 60000)
    public void reports() throws IOException {
        dailyReport.HadoopReport();
    }

    //@Scheduled(cron = "${job.schedule}")
    public void dailyReport() throws IOException {
        dailyReport.HadoopReport();
        log.info("dailyReport  HadoopReport  is run !!");
    }
}
